home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DATETIME.SWG / 0008_DATE7.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  41 lines

  1. {
  2. I have seen a number of Julian Date Functions showing up here lately.
  3. None of them seem to agree With each other.  of course, if your Program
  4. is the only thing using them, then it will remain consistent and work
  5. fine. But if you need to find the JD For astronomical or scientific
  6. purposes, then you will need to be able to agree With the accepted
  7. method.  The following seems to work well For me.  Using Real For the
  8. Var Types allows you to find the JD to great accuracy.
  9. BTW, JD 0.0 is Greenwich Mean Noon, Jan. 1, 4713 BC (which is why if you
  10. enter a "whole" day. ie. 1,2,3... your answer will have a '.5' at the
  11. end.
  12. }
  13.  
  14. Function JulianDate(Day, Month, Year : Real) : Real;
  15. Var
  16.   A, B, C, D : Real;
  17. begin
  18.   if Month <= 2 then
  19.   begin
  20.     Year  := Year - 1;
  21.     Month := Month + 12;
  22.   end;
  23.  
  24.   if Year >= 1582 then
  25.   begin
  26.     A := inT(Year / 100);
  27.     B := inT((2 - A) + inT(A / 4));
  28.   end
  29.   else
  30.     B := 0;
  31.  
  32.   if Year < 0 then
  33.     C := inT((365.25 * Year) - 0.75)
  34.   else
  35.     C := inT(365.25 * Year);
  36.  
  37.   D := inT (30.6001 * (Month + 1));
  38.   JulianDate :=  B + C + D + Day + 1720994.5;
  39. end;
  40.  
  41.